<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>原型对象创建方法案例</title>
	</head>
	<body>
	</body>
	<script>
		/*定义构造函数*/
		function Clothes(name , color){
			this.name = name;
			this.color = color;
		}
		
		/*为对象添加属性与方法*/
		Clothes.prototype.type = '衣服'; //定义共享属性
		Clothes.prototype.Clothes_fun = function(){
			document.write('小王穿的'+this.type+'是'+this.color+'的'+this.name+'<br>');
		};
		var c1 = new Clothes("连衣裙",'黑色');
		var c2 = new Clothes("吊带裙",'黄色');
		document.writeln(c1.color+'r'+c1.name+'d'+c1.type+'<br>');
		document.writeln(c2.color+'r'+c2.name+'d'+c2.type+'<br>');
    c2.Clothes_fun();
    c1.Clothes_fun();
	</script>
</html>
